<?php
/**
 * CreateTime: 2023/11/21 10:43
 * User:LinQ
 */

namespace App\State;

class StateBasic
{
    private StateInterface $state;

    public function __construct(StateInterface $state)
    {
        $this->state = $state;
    }

    /**
     * 通过状态值获取状态描述
     * @param $status int 状态
     * @return string
     */
    public function getStateDescription(int $status): string
    {
        return $this->state->getStateDescription($status);
    }

    /**
     * 从状态 $status -> $toStatus
     * @param $user_id int 用户id
     * @param $status int 状态
     * @param $toStatus int 要变化的状态
     * @return bool
     */
    public function stateChange(int $user_id, int $status, int $toStatus): bool
    {
        return $this->state->stateChange($user_id,$status,$toStatus);
    }

}